/*
 * server_sync.h
 *
 *  Created on: Jan 11, 2011
 *      Author: marco
 */

#ifndef SERVER_SYNC_H_
#define SERVER_SYNC_H_

#include "comsock.h" //ifndef??!

typedef struct{
	pthread_mutex_t mtx;

}active_users;



typedef struct{
	unsigned int lenght;
	pthread_mutex_t qmtx;
	pthread_cond_t qcond;
	struct msglist *head, *tail;
	struct msglist *msg_pool;
	unsigned int pool_lenght;

}msg_queue;



typedef struct {
	pthread_t *server_tid;// o direttamente il val?
	int sock;


}thread_info;



int queue_init(msg_queue *);

int queue_add(msg_queue *, message_t *);

int queue_get(msg_queue *, message_t *);












#endif /* SERVER_SYNC_H_ */
